package bb.lanxing.lib.devices.base.converter;

import android.bluetooth.BluetoothGattCharacteristic;
import bb.lanxing.lib.devices.base.CharacteristicConverter;
import bb.lanxing.lib.devices.ble.device.StandardHeartrateBeltDevice;
import bb.lanxing.lib.devices.core.ble.IGattClient;

public class HeartrateBeltConverter implements CharacteristicConverter {
    public void onHeartrate(int i, int i2) {
    }

    @Override
    public final void convert(IGattClient iGattClient, BluetoothGattCharacteristic bluetoothGattCharacteristic) {
        int intValue;
        if (bluetoothGattCharacteristic.getUuid().equals(StandardHeartrateBeltDevice.BLE_HEART_RATE_MEASUREMENT)) {
            if ((bluetoothGattCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, 0) & 1) == 0) {
                intValue = bluetoothGattCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, 1);
            } else {
                intValue = bluetoothGattCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT16, 1);
            }
            onHeartrate(iGattClient.getType(), intValue);
        }
    }
}
